UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XVYjlr0n6EiYpI9XzkhDIa87NiFerA4qsUscu5pgSxQ=' 
WHERE 
  key_id = '604a3b40125021c3705b386b6f8cf7bad14e25177c1dfe6c701cb016345d0569' 
  AND (
    token = 'XVYjlr0n6EiYpI9XzkhDIa87NiFerA4qsUscu5pgSxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035