UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3KMj1UQAGQ0UMaGX2llUlc84HelbRPHEIiilA1ZuayM=' 
WHERE 
  key_id = '06ea7223f54b7837a1effa99d85fe01f08252edf7a49412dee0f886d16a6d570' 
  AND (
    token = '3KMj1UQAGQ0UMaGX2llUlc84HelbRPHEIiilA1ZuayM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015