UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pUk3t5EfTvmDUxE+NyQoAD/mjPaZ+HnDYzzCK53Rv4Q=' 
WHERE 
  key_id = '7ed9a198143ef06b199120bd64fd46dd0c6dbd6d02c941b849c81a5cdeec1ea4' 
  AND (
    token = 'pUk3t5EfTvmDUxE+NyQoAD/mjPaZ+HnDYzzCK53Rv4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041