UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TjWEUDrGM+RtLgbAd8ZWdPBoFwTu9+6p1kHciz7f2F8=' 
WHERE 
  key_id = '15f2f496ca00cf71ce796b036a91e717bb42ef3a0830380d0373e41a80706920' 
  AND (
    token = 'TjWEUDrGM+RtLgbAd8ZWdPBoFwTu9+6p1kHciz7f2F8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035