UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4Yp/vZ+MvO6g0B0ibin2RYuNNLrZYCQ9LdgIUp87jbs=' 
WHERE 
  key_id = 'ea3052e8876d1900d0e0d834f2b7166733ded5a030cbee4d7772cdbfdba53620' 
  AND (
    token = '4Yp/vZ+MvO6g0B0ibin2RYuNNLrZYCQ9LdgIUp87jbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025