UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bMAxlOhE3KyIp9xxgL2qhg+n+CIoSGyLDq1Bcz5H+tU=' 
WHERE 
  key_id = '05478e1498c8eaaebf2656c92ed5ebdf3786b1b24f8687e8debcfc3586dc49ac' 
  AND (
    token = 'bMAxlOhE3KyIp9xxgL2qhg+n+CIoSGyLDq1Bcz5H+tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029