UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rH4odhb/5K+Y60lVli9m5sCph9SNWVez0d58+x4YiBs=' 
WHERE 
  key_id = '1bf3dd49a942dbb940a4b075e6f54bf7f5d17b1ff963d67b5f4a21b73ce31fa6' 
  AND (
    token = 'rH4odhb/5K+Y60lVli9m5sCph9SNWVez0d58+x4YiBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043