UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ebdguOWKgrgIKTsmTRSBcpVS+9dZ2HnvsmwGiUw1a6k=' 
WHERE 
  key_id = 'c2371578e3873e0c7c836004c951fd99e99d582727dff115b7c21be2f3a8fbb8' 
  AND (
    token = 'ebdguOWKgrgIKTsmTRSBcpVS+9dZ2HnvsmwGiUw1a6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022