UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J3IGIAygySW/ZrcZg9cbAA5vP5I0aOs8ZsQS3GXjZ+E=' 
WHERE 
  key_id = '0b5b5fb9fdb64c3948259351020671d19cb0695d271a29cf02c00dc442354da7' 
  AND (
    token = 'J3IGIAygySW/ZrcZg9cbAA5vP5I0aOs8ZsQS3GXjZ+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018