UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7BScpaESYs/VnAx6P9qjm7OfGPTio8lT3sfsVrQkPkY=' 
WHERE 
  key_id = 'c2b05f5ba18309960cafe24d2bec4b93a0de5d08d77e03c611c8d49b88076938' 
  AND (
    token = '7BScpaESYs/VnAx6P9qjm7OfGPTio8lT3sfsVrQkPkY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037