UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IXERK3PyKE+F3Kb78lujfblsPGcdBtIypJOpZzDjKQI=' 
WHERE 
  key_id = '947d1ff8fdf4360120a57f58c69261eeb7e4fb9f252799ed800c717d75329c28' 
  AND (
    token = 'IXERK3PyKE+F3Kb78lujfblsPGcdBtIypJOpZzDjKQI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047