UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ClBPBRXGd2/P0ZAbQD5HB1f2A+A+ODkhLXl5C28W2QA=' 
WHERE 
  key_id = '243405eabdfd7653daf19ae49e94e4f153fec49530972b496556bdf7c4c05ce8' 
  AND (
    token = 'ClBPBRXGd2/P0ZAbQD5HB1f2A+A+ODkhLXl5C28W2QA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029