UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nDyEUt3wA/DZNNsEX2mLXoK0cLm7xC81BxH+QSQD8xM=' 
WHERE 
  key_id = 'e1041e355319c201471432110241454e346e5a173d7d2c6bfb147f54b336d524' 
  AND (
    token = 'nDyEUt3wA/DZNNsEX2mLXoK0cLm7xC81BxH+QSQD8xM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041