UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZWaluycHDrk+UDojF0psYiv3gsXj86f2pHzpcQr7Ibk=' 
WHERE 
  key_id = '6890201b5bed5a70bf30c32b19eb039b5b4e12af07b5182ca89989b2a8577441' 
  AND (
    token = 'ZWaluycHDrk+UDojF0psYiv3gsXj86f2pHzpcQr7Ibk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027