UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PlHmH7yGSTHFqPdyX1gMhYoj2ogL2L/r6YvmYcTwYeo=' 
WHERE 
  key_id = 'fd65bda0afe39bed687b33ed76250027f4fc5074dc2aac5662e3f26a07ed6656' 
  AND (
    token = 'PlHmH7yGSTHFqPdyX1gMhYoj2ogL2L/r6YvmYcTwYeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041