UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YQWATe96p0MP8WBGHOl11zE8FSyUcrhR5srElRPpXhE=' 
WHERE 
  key_id = '59ad5db3a06c001a126e70a0577d8feed91a5e57fd652177295b924c76b17a95' 
  AND (
    token = 'YQWATe96p0MP8WBGHOl11zE8FSyUcrhR5srElRPpXhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019