UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RzbL3AouHfrpX4+ChuRxEqSlIn1F/FCn9atYkrxj530=' 
WHERE 
  key_id = '857df8b05ccdfb2e6f062b2a18a4f25af12cea4377808d9d877b85b6d118399d' 
  AND (
    token = 'RzbL3AouHfrpX4+ChuRxEqSlIn1F/FCn9atYkrxj530=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033