UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bhAYkjS1wa+sME9g1bIddu0YGJInpb0Cy72aKWW625I=' 
WHERE 
  key_id = '09c25ff79195e42b1df0a38078801de3d379fbab27e6fb464b1ac33bb4c7b655' 
  AND (
    token = 'bhAYkjS1wa+sME9g1bIddu0YGJInpb0Cy72aKWW625I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045