UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S5qYGeKXobqNkvnQBmFsYwULXS6keHue0AY+5LLe4lQ=' 
WHERE 
  key_id = '52e8ba6398f46445646c14a783a32dd07cf911cd4e3546a58f24227aa133bea1' 
  AND (
    token = 'S5qYGeKXobqNkvnQBmFsYwULXS6keHue0AY+5LLe4lQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024