UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zwj2ltm8VKPN8SgNMRWoAb9mB/TDQecT4KgCTpsNRnc=' 
WHERE 
  key_id = '0d3713ef72f38550d8620dab417b35b95f21b97a255719983869898dc59d0123' 
  AND (
    token = 'Zwj2ltm8VKPN8SgNMRWoAb9mB/TDQecT4KgCTpsNRnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00012