UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5cnlweZ7MUV8H5KPiz4NWCAG2PmAqZ6D3+8HacE/rQg=' 
WHERE 
  key_id = '09e888311d5b5a7d13aab89059045ff2b454008c366fcec1c4dbfa4f314131f2' 
  AND (
    token = '5cnlweZ7MUV8H5KPiz4NWCAG2PmAqZ6D3+8HacE/rQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025