UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gkyCXPkLDTO19eh6mabpKSjgrTp2l0otqeSjdohr+AM=' 
WHERE 
  key_id = '9e1eba5990a60b775ab8a1423543b927423b56684b60e9cecb5fec46576bd03f' 
  AND (
    token = 'gkyCXPkLDTO19eh6mabpKSjgrTp2l0otqeSjdohr+AM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039