UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UBhO7upXJwgll/C+mulRw0TdJihA4Cyv0cz7g44R1RY=' 
WHERE 
  key_id = '8386f3ff231d7b65732073b8966bb68ba71e95339c97006b8ca0a1cdafcc2d72' 
  AND (
    token = 'UBhO7upXJwgll/C+mulRw0TdJihA4Cyv0cz7g44R1RY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031