UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e3k1pmsPQBQuh13NQ+D1aXLCrR7s/hBA409W/YzjL68=' 
WHERE 
  key_id = '822fd839d2d75fcb2adc29c0132f821ce0504f5451098594ca03f95c70f84137' 
  AND (
    token = 'e3k1pmsPQBQuh13NQ+D1aXLCrR7s/hBA409W/YzjL68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021