UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'znMa5jKoo2RqUJmDRbGxlSFEQpgWaWeOGfR7HI7r0dI=' 
WHERE 
  key_id = '6644430df625c26123207fb63be2c793eb223c59a065105cf0415e1d7234829c' 
  AND (
    token = 'znMa5jKoo2RqUJmDRbGxlSFEQpgWaWeOGfR7HI7r0dI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045