UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bn/feBIP6VIsxzvPfxq/qHmLOX6Avz9yqIaQseNzDxk=' 
WHERE 
  key_id = '31b23ab81cfc363e6f4976315c3119937227892d72e8030c80ac224334576dc0' 
  AND (
    token = 'Bn/feBIP6VIsxzvPfxq/qHmLOX6Avz9yqIaQseNzDxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034