UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GG+oe+/JSs0hz7BEg3csQuTUQH8lC490dx3gQLWFNK8=' 
WHERE 
  key_id = 'b23574be8d5dde4270471c2a004c32b2e45df15cbf68a337b7383885c9adf116' 
  AND (
    token = 'GG+oe+/JSs0hz7BEg3csQuTUQH8lC490dx3gQLWFNK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040