UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BW1vLPnZTS0OuN0E13rPjCqmX9JXM3rlr1VInfu/vC0=' 
WHERE 
  key_id = '5652a7b16ee2cfef5d191816513cc6c30f07d21a10511b0cfbf61ddb78e9aa74' 
  AND (
    token = 'BW1vLPnZTS0OuN0E13rPjCqmX9JXM3rlr1VInfu/vC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019