UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5L9Q3Mn6p+GT4+2E3f+6DtLfsFSLVuQiJNkm5BVHe9s=' 
WHERE 
  key_id = 'c56dcce728813053529f32e37e691a4c2196240180b965aabdc1907109715f6d' 
  AND (
    token = '5L9Q3Mn6p+GT4+2E3f+6DtLfsFSLVuQiJNkm5BVHe9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026