UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ci4ulhABWWnUx7bAFFibcozrsKoDf14VGN6VcF6TXPU=' 
WHERE 
  key_id = '1833b8ae0d75ad4b862088af5a126928f5cace358466e08aacde65e68d6f2e74' 
  AND (
    token = 'ci4ulhABWWnUx7bAFFibcozrsKoDf14VGN6VcF6TXPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050