UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OSh0b6oW9ffFROtSnFOZvt4gwAL4xuTcr/+HEJyILKk=' 
WHERE 
  key_id = '0f0f12d9a57669ae47360b407b59a340b1e07bb9ec9965fa7fe713c6b068cd31' 
  AND (
    token = 'OSh0b6oW9ffFROtSnFOZvt4gwAL4xuTcr/+HEJyILKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032