UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BN1zt4n1Ts4lon+kq3NOBsJnzV1Wl+RYPgukoTCOTsc=' 
WHERE 
  key_id = 'bbba774e70b07e3de572f16eaf7249c8cf71ced576335a433a445f7c4be7e18a' 
  AND (
    token = 'BN1zt4n1Ts4lon+kq3NOBsJnzV1Wl+RYPgukoTCOTsc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034